# -*- coding:utf-8 -*-

from com.mat.rpa.utils.globalConstants import GlobalConstants
from com.mat.rpa.views.workWindow.leftPanel.directiveTree import treeItem
from . import exceptionHandlerConstants

class ExceptionHandlerSubDirectiveTree(treeItem.TreeItemWithID):
    def __init__(self, parent):
        super(ExceptionHandlerSubDirectiveTree, self).__init__(parent)
        self.createExceptionHandlerTreeNode()

    def createExceptionHandlerTreeNode(self):
        self.nodeType = GlobalConstants.treeBranchType
        self.directiveType = "exceptionHandler"
        self.setText(0,"异常处理")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, exceptionHandlerConstants.ExceptionHandlerConstants.tryDirective, "Try")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, exceptionHandlerConstants.ExceptionHandlerConstants.catchDirective, "Catch")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, exceptionHandlerConstants.ExceptionHandlerConstants.finallyDirective, "Finally")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, exceptionHandlerConstants.ExceptionHandlerConstants.endTryDirective, "End Try")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, exceptionHandlerConstants.ExceptionHandlerConstants.raiseDirective, "Raise")
